package com.gateway.common.constant;

/**
 * @program: api-gateway
 * @description:
 * @author: YuKai Fan
 * @create: 2025/1/27 20:59
 **/
public interface Constants {

    /**
     * cache data max size, means map size.
     */
    Long LRU_MAP_MAXSIZE = 65536L;


    /**
     * The maximum free memory reserved by the blocking queue for the JVM.
     */
    int THE_256_MB = 256 * 1024 * 1024;


    /**
     * The constant context path.
     */
    String CONTEXT_PATH = "contextPath";


    /**
     * The constant URI_SUFFIX.
     */
   String URI_SUFFIX = "/**";

    /**
     * The constant URI_SLASH_SUFFIX.
     */
    String URI_SLASH_SUFFIX = "/";

    /**
     * The constant URI_VARIABLE_SUFFIX.
     */
    String URI_VARIABLE_SUFFIX = "{";

    /**
     * the constant of ROUTE_META_DATA.
     */
    String ROUTE_META_DATA = "routeMetadata";

    /**
     * platform
     */
    String PLATFORM = "platform";

    /**
     * apiData
     */
    String API_DATA = "apiData";

    /**
     * the constant CLIENT_RESPONSE_ATTR.
     */
    String CLIENT_RESPONSE_ATTR = "webHandlerClientResponse";

    /**
     * the constant CONTEXT.
     */
    String CONTEXT = "cacheGatewayContext";


    /**
     * redis script path.
     */
    String SCRIPT_PATH = "/META-INF/scripts/";

    /**
     * ratelimiter timeoutDurationRate.
     */
    int TIMEOUT_DURATION_RATE = 5000;


    /**
     * ratelimiter limitRefreshPeriod.
     */
    int LIMIT_REFRESH_PERIOD = 500;

    /**
     * ratelimiter limitForPeriod.
     */
    int LIMIT_FOR_PERIOD = 50;

    /**
     * circuitBreaker circuitEnable.
     */
    int CIRCUIT_DISABLE = 0;

    /**
     * circuitBreaker enable.
     */
    int CIRCUIT_ENABLE = 1;

    /**
     * circuitBreaker timeoutDuration.
     */
    long TIMEOUT_DURATION = 30000;

    /**
     * circuitBreaker slidingWindowSize.
     */
    int SLIDING_WINDOW_SIZE = 100;

    /**
     * circuitBreaker slidingWindowType.
     */
    int SLIDING_WINDOW_TYPE = 0;

    /**
     * circuitBreaker minimumNumberOfCalls.
     */
    int MINIMUM_NUMBER_OF_CALLS = 100;

    /**
     * circuitBreaker waitIntervalFunctionInOpenState.
     */
    int WAIT_INTERVAL_FUNCTION_IN_OPEN_STATE = 60000;

    /**
     * circuitBreaker waitIntervalFunctionInOpenState.
     */
    int PERMITTED_NUMBER_OF_CALLS_IN_HALF_OPEN_STATE = 10;

    /**
     * circuitBreaker failureRateThreshold.
     */
    float FAILURE_RATE_THRESHOLD = 50;

    /**
     * circuitBreaker automaticTransitionFromOpenToHalfOpenEnabled.
     */
    boolean AUTOMATIC_TRANSITION_FROM_OPEN_TO_HALF_OPEN_ENABLED = false;
}
